<?php

use think\facade\Route;

// 管理员路由分组
Route::group('admin', function () {
    Route::post('login', 'app\controller\admin\Login@login');//登录
    Route::post('logout', 'app\controller\admin\Login@logout');//退出登录
    Route::get('info', 'app\controller\admin\Setting@admin_info');//账户信息
    Route::put('change_pwd', 'app\controller\admin\Setting@change_password');//账户信息

    //菜单列表
    Route::get('menu', 'app\controller\admin\Setting@menu_list');

    // 用户管理相关
    Route::group('user', function () {
        Route::rule('list', 'app\controller\admin\User@list', 'GET|POST');// 获取用户列表
        Route::rule('get', 'app\controller\admin\User@get', 'POST|GET'); // 获取指定用户信息
        Route::put('save', 'app\controller\admin\User@save');// 新增、修改
    });

    // 包更新管理相关
    Route::group('package', function () {
        Route::get('list', 'app\controller\admin\Package@list');// 获取列表
        Route::get(':id', 'app\controller\admin\Package@get'); // 获取指定信息
        Route::put('/state/:id', 'app\controller\admin\Package@state'); //
        Route::post('add', 'app\controller\admin\Package@add');// 新增
        Route::put(':id', 'app\controller\admin\Package@update');// 修改
        Route::delete(':id', 'app\controller\admin\Package@delete');// 删除
        Route::post('push_update', 'app\controller\admin\Package@start_update');// 推送更新
    });

    // 配置项
    Route::group('setting', function () {
        Route::rule('list', 'app\controller\admin\Setting@list', 'GET');
        Route::get('get', 'app\controller\admin\Setting@get');// 获取配置项
        Route::rule('save', 'app\controller\admin\Setting@save_data', 'POST|PUT');// 更新配置项
        Route::delete('delete', 'app\controller\admin\Setting@delete');
    });

    //上传相关
    Route::group('upload', function () {
        Route::rule('file', 'app\controller\admin\Upload@file', 'POST');//图片上传
        Route::rule('image', 'app\controller\admin\Upload@image', 'POST');//图片上传
        Route::rule('chunk', 'app\controller\admin\Upload@chunk', 'POST');//文件分片上传
        Route::rule('upload_group', 'app\controller\admin\Upload@list_group', 'POST|GET|PUT|DELETE');
        Route::rule('index', 'app\controller\admin\Upload@list', 'POST|GET');
        Route::rule('list', 'app\controller\admin\Upload@list', 'POST|GET');
        Route::get('get', 'app\controller\admin\Upload@get');
        Route::delete('delete', 'app\controller\admin\Upload@del_data');
        Route::rule('ueditor', 'app\controller\admin\Upload@ueditor', 'POST|GET|DELETE|PUT');

    });

    //统计
    Route::group('statistics', function () {
        Route::get('list', 'app\controller\admin\Statistics@list');
    });

    //更新日志
    Route::group('update_log', function () {
        Route::get('list', 'app\controller\admin\UpdateLog@list');
        Route::get('get', 'app\controller\admin\UpdateLog@get');
        Route::rule('save', 'app\controller\admin\UpdateLog@save_data', 'POST|PUT');
        Route::delete('delete', 'app\controller\admin\UpdateLog@del_data');
    });

    //反馈
    Route::group('feedback', function () {
        Route::get('list', 'app\controller\admin\Feedback@list');
        Route::get('get', 'app\controller\admin\Feedback@get');
        Route::rule('save', 'app\controller\admin\Feedback@save_data', 'POST|PUT');
        Route::delete('delete', 'app\controller\admin\Feedback@del_data');
    });

    //通知管理
    Route::group('notice', function () {
        Route::get('list', 'app\controller\admin\Notice@list');
        Route::get('get', 'app\controller\admin\Notice@get');
        Route::rule('save', 'app\controller\admin\Notice@save_data', 'POST|PUT');
        Route::delete('delete', 'app\controller\admin\Notice@del_data');
    });

    //帮助
    Route::group('help', function () {
        Route::get('list', 'app\controller\admin\Help@list');
        Route::get('get', 'app\controller\admin\Help@get');
        Route::rule('save', 'app\controller\admin\Help@save_data', 'POST|PUT');
        Route::delete('delete', 'app\controller\admin\Help@del_data');
    });

    // 队列
    Route::group('queue', function () {
        Route::rule('list', 'app\controller\admin\Queue@list', 'GET');
        Route::get('get', 'app\controller\admin\Queue@get');//
        Route::rule('save', 'app\controller\admin\Queue@save_data', 'POST|PUT');//
        Route::delete('delete', 'app\controller\admin\Queue@del_data');
        Route::post('re_do', 'app\controller\admin\Queue@redo_job');
    });

    //访客日志
    Route::group('access_log', function () {
        Route::rule('list', 'app\controller\admin\AccessLog@list', 'GET');
        Route::get('get', 'app\controller\admin\AccessLog@get');//
        Route::rule('save', 'app\controller\admin\AccessLog@save_data', 'POST|PUT');//
        Route::delete('delete', 'app\controller\admin\AccessLog@del_data');
    });

    //短信日志
    Route::group('code_log', function () {
        Route::rule('list', 'app\controller\admin\CodeLog@list', 'GET');
    });

    //系统统计
    Route::group('sys_statistics', function () {
        Route::rule('list', 'app\controller\admin\SysStatistics@list', 'GET');
    });

     //扩展插件
    Route::group('plugins', function () {
        Route::get('list', 'app\controller\admin\Plugins@list');
        Route::get('get', 'app\controller\admin\Plugins@get');
        Route::rule('save', 'app\controller\admin\Plugins@save_data', 'POST|PUT');
        Route::delete('delete', 'app\controller\admin\Plugins@del_data');
    });
});
